home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2007 January, February, March & April
/
Chip-Cover-CD-2007-02.iso
/
Pakiet bezpieczenstwa
/
mini Pentoo LiveCD 2006.1
/
mpentoo-2006.1.iso
/
livecd.squashfs
/
usr
/
lib
/
python2.4
/
distutils
/
dist.pyo
(
.txt
)
< prev
next >
Wrap
Python Compiled Bytecode
|
2005-10-18
|
33KB
|
1,006 lines
# Source Generated with Decompyle++
# File: in.pyo (Python 2.4)
'''distutils.dist
Provides the Distribution class, which represents the module distribution
being built/installed/distributed.
'''
__revision__ = '$Id: dist.py,v 1.72 2004/11/10 22:23:14 loewis Exp $'
import sys
import os
import string
import re
from types import *
from copy import copy
try:
import warnings
except ImportError:
warnings = None
from distutils.errors import *
from distutils.fancy_getopt import FancyGetopt, translate_longopt
from distutils.util import check_environ, strtobool, rfc822_escape
from distutils import log
from distutils.debug import DEBUG
command_re = re.compile('^[a-zA-Z]([a-zA-Z0-9_]*)$')
class Distribution:
"""The core of the Distutils. Most of the work hiding behind 'setup'
is really done within a Distribution instance, which farms the work out
to the Distutils commands specified on the command line.
Setup scripts will almost never instantiate Distribution directly,
unless the 'setup()' function is totally inadequate to their needs.
However, it is conceivable that a setup script might wish to subclass
Distribution for some specialized purpose, and then pass the subclass
to 'setup()' as the 'distclass' keyword argument. If so, it is
necessary to respect the expectations that 'setup' has of Distribution.
See the code for 'setup()', in core.py, for details.
"""
global_options = [
('verbose', 'v', 'run verbosely (default)', 1),
('quiet', 'q', 'run quietly (turns verbosity off)'),
('dry-run', 'n', "don't actually do anything"),
('help', 'h', 'show detailed help message')]
display_options = [
('help-commands', None, 'list all available commands'),
('name', None, 'print package name'),
('version', 'V', 'print package version'),
('fullname', None, 'print <package name>-<version>'),
('author', None, "print the author's name"),
('author-email', None, "print the author's email address"),
('maintainer', None, "print the maintainer's name"),
('maintainer-email', None, "print the maintainer's email address"),
('contact', None, "print the maintainer's name if known, else the author's"),
('contact-email', None, "print the maintainer's email address if known, else the author's"),
('url', None, 'print the URL for this package'),
('license', None, 'print the license of the package'),
('licence', None, 'alias for --license'),
('description', None, 'print the package description'),
('long-description', None, 'print the long package description'),
('platforms', None, 'print the list of platforms'),
('classifiers', None, 'print the list of classifiers'),
('keywords', None, 'print the list of keywords')]
display_option_names = map((lambda x: translate_longopt(x[0])), display_options)
negative_opt = {
'quiet': 'verbose' }
def __init__(self, attrs = None):
'''Construct a new Distribution instance: initialize all the
attributes of a Distribution, and then use \'attrs\' (a dictionary
mapping attribute names to values) to assign some of those
attributes their "real" values. (Any attributes not mentioned in
\'attrs\' will be assigned to some null value: 0, None, an empty list
or dictionary, etc.) Most importantly, initialize the
\'command_obj\' attribute to the empty dictionary; this will be
filled in with real command objects by \'parse_command_line()\'.
'''
self.verbose = 1
self.dry_run = 0
self.help = 0
for attr in self.display_option_names:
setattr(self, attr, 0)
self.metadata = DistributionMetadata()
for basename in self.metadata._METHOD_BASENAMES:
method_name = 'get_' + basename
setattr(self, method_name, getattr(self.metadata, method_name))
self.cmdclass = { }
self.command_packages = None
self.script_name = None
self.script_args = None
self.command_options = { }
self.packages = None
self.package_data = { }
self.package_dir = None
self.py_modules = None
self.libraries = None
self.headers = None
self.ext_modules = None
self.ext_package = None
self.include_dirs = None
self.extra_path = None
self.scripts = None
self.data_files = None
self.command_obj = { }
self.have_run = { }
if attrs:
options = attrs.get('options')
if options:
del attrs['options']
for command, cmd_options in options.items():
opt_dict = self.get_option_dict(command)
for opt, val in cmd_options.items():
opt_dict[opt] = ('setup script', val)
if attrs.has_key('licence'):
attrs['license'] = attrs['licence']
del attrs['licence']
msg = "'licence' distribution option is deprecated; use 'license'"
if warnings is not None:
warnings.warn(msg)
else:
sys.stderr.write(msg + '\n')
for key, val in attrs.items():
if hasattr(self.metadata, key):
setattr(self.metadata, key, val)
continue
if hasattr(self, key):
setattr(self, key, val)
continue
msg = 'Unknown distribution option: %s' % repr(key)
if warnings is not None:
warnings.warn(msg)
continue
sys.stderr.write(msg + '\n')
self.finalize_options()
def get_option_dict(self, command):
"""Get the option dictionary for a given command. If that
command's option dictionary hasn't been created yet, then create it
and return the new dictionary; otherwise, return the existing
option dictionary.
"""
dict = self.command_options.get(command)
if dict is None:
dict = self.command_options[command] = { }
return dict
def dump_option_dicts(self, header = None, commands = None, indent = ''):
pformat = pformat
import pprint
if commands is None:
commands = self.command_options.keys()
commands.sort()
if header is not None:
print indent + header
indent = indent + ' '
if not commands:
print indent + 'no commands known yet'
return None
for cmd_name in commands:
opt_dict = self.command_options.get(cmd_name)
if opt_dict is None:
print indent + "no option dict for '%s' command" % cmd_name
continue
print indent + "option dict for '%s' command:" % cmd_name
out = pformat(opt_dict)
for line in string.split(out, '\n'):
print indent + ' ' + line
def find_config_files(self):
"""Find as many configuration files as should be processed for this
platform, and return a list of filenames in the order in which they
should be parsed. The filenames returned are guaranteed to exist
(modulo nasty race conditions).
There are three possible config files: distutils.cfg in the
Distutils installation directory (ie. where the top-level
Distutils __inst__.py file lives), a file in the user's home
directory named .pydistutils.cfg on Unix and pydistutils.cfg
on Windows/Mac, and setup.cfg in the current directory.
"""
files = []
check_environ()
sys_dir = os.path.dirname(sys.modules['distutils'].__file__)
sys_file = os.path.join(sys_dir, 'distutils.cfg')
if os.path.isfile(sys_file):
files.append(sys_file)
if os.name == 'posix':
user_filename = '.pydistutils.cfg'
else:
user_filename = 'pydistutils.cfg'
if os.environ.has_key('HOME'):
user_file = os.path.join(os.environ.get('HOME'), user_filename)
if os.path.isfile(user_file):
files.append(user_file)
local_file = 'setup.cfg'
if os.path.isfile(local_file):
files.append(local_file)
return files
def parse_config_files(self, filenames = None):
ConfigParser = ConfigParser
import ConfigParser
if filenames is None:
filenames = self.find_config_files()
if DEBUG:
print 'Distribution.parse_config_files():'
parser = ConfigParser()
for filename in filenames:
if DEBUG:
print ' reading', filename
parser.read(filename)
for section in parser.sections():
options = parser.options(section)
opt_dict = self.get_option_dict(section)
for opt in options:
if opt != '__name__':
val = parser.get(section, opt)
opt = string.replace(opt, '-', '_')
opt_dict[opt] = (filename, val)
continue
parser.__init__()
def parse_command_line(self):
'''Parse the setup script\'s command line, taken from the
\'script_args\' instance attribute (which defaults to \'sys.argv[1:]\'
-- see \'setup()\' in core.py). This list is first processed for
"global options" -- options that set attributes of the Distribution
instance. Then, it is alternately scanned for Distutils commands
and options for that command. Each new command terminates the
options for the previous command. The allowed options for a
command are determined by the \'user_options\' attribute of the
command class -- thus, we have to be able to load command classes
in order to parse the command line. Any error in that \'options\'
attribute raises DistutilsGetoptError; any error on the
command-line raises DistutilsArgError. If no Distutils commands
were found on the command line, raises DistutilsArgError. Return
true if command-line was successfully parsed and we should carry
on with executing commands; false if no errors but we shouldn\'t
execute commands (currently, this only happens if user asks for
help).
'''
toplevel_options = self._get_toplevel_options()
if sys.platform == 'mac':
import EasyDialogs as EasyDialogs
cmdlist = self.get_command_list()
self.script_args = EasyDialogs.GetArgv(toplevel_options + self.display_options, cmdlist)
self.commands = []
parser = FancyGetopt(toplevel_options + self.display_options)
parser.set_negative_aliases(self.negative_opt)
parser.set_aliases({
'licence': 'license' })
args = parser.getopt(args = self.script_args, object = self)
option_order = parser.get_option_order()
log.set_verbosity(self.verbose)
if self.handle_display_options(option_order):
return None
while args:
args = self._parse_command_opts(parser, args)
if args is None:
return None
continue
if self.help:
self._show_help(parser, display_options = len(self.commands) == 0, commands = self.commands)
return None
if not self.commands:
raise DistutilsArgError, 'no commands supplied'
return 1
def _get_toplevel_options(self):
'''Return the non-display options recognized at the top level.
This includes options that are recognized *only* at the top
level as well as options recognized for commands.
'''
return self.global_options + [
('command-packages=', None, 'list of packages that provide distutils commands')]
def _parse_command_opts(self, parser, args):
"""Parse the command-line options for a single command.
'parser' must be a FancyGetopt instance; 'args' must be the list
of arguments, starting with the current command (whose options
we are about to parse). Returns a new version of 'args' with
the next command at the front of the list; will be the empty
list if there are no more commands on the command line. Returns
None if the user asked for help on this command.
"""
Command = Command
import distutils.cmd
command = args[0]
if not command_re.match(command):
raise SystemExit, "invalid command name '%s'" % command
self.commands.append(command)
try:
cmd_class = self.get_command_class(command)
except DistutilsModuleError:
msg = None
raise DistutilsArgError, msg
if not issubclass(cmd_class, Command):
raise DistutilsClassError, 'command class %s must subclass Command' % cmd_class
if not hasattr(cmd_class, 'user_options') and type(cmd_class.user_options) is ListType:
raise DistutilsClassError, ('command class %s must provide ' + "'user_options' attribute (a list of tuples)") % cmd_class
negative_opt = self.negative_opt
if hasattr(cmd_class, 'negative_opt'):
negative_opt = copy(negative_opt)
negative_opt.update(cmd_class.negative_opt)
if hasattr(cmd_class, 'help_options') and type(cmd_class.help_options) is ListType:
help_options = fix_help_options(cmd_class.help_options)
else:
help_options = []
parser.set_option_table(self.global_options + cmd_class.user_options + help_options)
parser.set_negative_aliases(negative_opt)
(args, opts) = parser.getopt(args[1:])
if hasattr(opts, 'help') and opts.help:
self._show_help(parser, display_options = 0, commands = [
cmd_class])
return None
if hasattr(cmd_class, 'help_options') and type(cmd_class.help_options) is ListType:
help_option_found = 0
for help_option, short, desc, func in cmd_class.help_options:
if hasattr(opts, parser.get_attr_name(help_option)):
help_option_found = 1
if callable(func):
func()
else:
raise DistutilsClassError("invalid help function %r for help option '%s': must be a callable object (function, etc.)" % (func, help_option))
callable(func)
if help_option_found:
return None
opt_dict = self.get_option_dict(command)
for name, value in vars(opts).items():
opt_dict[name] = ('command line', value)
return args
def finalize_options(self):
'''Set final values for all the options on the Distribution
instance, analogous to the .finalize_options() method of Command
objects.
'''
keywords = self.metadata.keywords
if keywords is not None:
if type(keywords) is StringType:
keywordlist = string.split(keywords, ',')
self.metadata.keywords = map(string.strip, keywordlist)
platforms = self.metadata.platforms
if platforms is not None:
if type(platforms) is StringType:
platformlist = string.split(platforms, ',')
self.metadata.platforms = map(string.strip, platformlist)
def _show_help(self, parser, global_options = 1, display_options = 1, commands = []):
'''Show help for the setup script command-line in the form of
several lists of command-line options. \'parser\' should be a
FancyGetopt instance; do not expect it to be returned in the
same state, as its option table will be reset to make it
generate the correct help text.
If \'global_options\' is true, lists the global options:
--verbose, --dry-run, etc. If \'display_options\' is true, lists
the "display-only" options: --name, --version, etc. Finally,
lists per-command help for every command name or command class
in \'commands\'.
'''
gen_usage = gen_usage
import distutils.core
Command = Command
import distutils.cmd
if global_options:
if display_options:
options = self._get_toplevel_options()
else:
options = self.global_options
parser.set_option_table(options)
parser.print_help('Global options:')
print
if display_options:
parser.set_option_table(self.display_options)
parser.print_help('Information display options (just display ' + 'information, ignore any commands)')
print
for command in self.commands:
if type(command) is ClassType and issubclass(command, Command):
klass = command
else:
klass = self.get_command_class(command)
if hasattr(klass, 'help_options') and type(klass.help_options) is ListType:
parser.set_option_table(klass.user_options + fix_help_options(klass.help_options))
else:
parser.set_option_table(klass.user_options)
parser.print_help("Options for '%s' command:" % klass.__name__)
print
print gen_usage(self.script_name)
def handle_display_options(self, option_order):
'''If there were any non-global "display-only" options
(--help-commands or the metadata display options) on the command
line, display the requested info and return true; else return
false.
'''
gen_usage = gen_usage
import distutils.core
if self.help_commands:
self.print_commands()
print
print gen_usage(self.script_name)
return 1
any_display_options = 0
is_display_option = { }
for option in self.display_options:
is_display_option[option[0]] = 1
for opt, val in option_order:
if val and is_display_option.get(opt):
opt = translate_longopt(opt)
value = getattr(self.metadata, 'get_' + opt)()
if opt in [
'keywords',
'platforms']:
print string.join(value, ',')
elif opt == 'classifiers':
print string.join(value, '\n')
else:
print value
any_display_options = 1
continue
return any_display_options
def print_command_list(self, commands, header, max_length):
"""Print a subset of the list of all commands -- used by
'print_commands()'.
"""
print header + ':'
for cmd in commands:
klass = self.cmdclass.get(cmd)
if not klass:
klass = self.get_command_class(cmd)
try:
description = klass.description
except AttributeError:
description = '(no description available)'
print ' %-*s %s' % (max_length, cmd, description)
def print_commands(self):
'''Print out a help message listing all available commands with a
description of each. The list is divided into "standard commands"
(listed in distutils.command.__all__) and "extra commands"
(mentioned in self.cmdclass, but not a standard command). The
descriptions come from the command class attribute
\'description\'.
'''
import distutils.command as distutils
std_commands = distutils.command.__all__
is_std = { }
for cmd in std_commands:
is_std[cmd] = 1
extra_commands = []
for cmd in self.cmdclass.keys():
if not is_std.get(cmd):
extra_commands.append(cmd)
continue
max_length = 0
for cmd in std_commands + extra_commands:
if len(cmd) > max_length:
max_length = len(cmd)
continue
self.print_command_list(std_commands, 'Standard commands', max_length)
if extra_commands:
print
self.print_command_list(extra_commands, 'Extra commands', max_length)
def get_command_list(self):
'''Get a list of (command, description) tuples.
The list is divided into "standard commands" (listed in
distutils.command.__all__) and "extra commands" (mentioned in
self.cmdclass, but not a standard command). The descriptions come
from the command class attribute \'description\'.
'''
import distutils.command as distutils
std_commands = distutils.command.__all__
is_std = { }
for cmd in std_commands:
is_std[cmd] = 1
extra_commands = []
for cmd in self.cmdclass.keys():
if not is_std.get(cmd):
extra_commands.append(cmd)
continue
rv = []
for cmd in std_commands + extra_commands:
klass = self.cmdclass.get(cmd)
if not klass:
klass = self.get_command_class(cmd)
try:
description = klass.description
except AttributeError:
description = '(no description available)'
rv.append((cmd, description))
return rv
def get_command_packages(self):
'''Return a list of packages from which commands are loaded.'''
pkgs = self.command_packages
if not isinstance(pkgs, type([])):
if not pkgs:
pass
pkgs = string.split('', ',')
for i in range(len(pkgs)):
pkgs[i] = string.strip(pkgs[i])
pkgs = filter(None, pkgs)
if 'distutils.command' not in pkgs:
pkgs.insert(0, 'distutils.command')
self.command_packages = pkgs
return pkgs
def get_command_class(self, command):
'''Return the class that implements the Distutils command named by
\'command\'. First we check the \'cmdclass\' dictionary; if the
command is mentioned there, we fetch the class object from the
dictionary and return it. Otherwise we load the command module
("distutils.command." + command) and fetch the command class from
the module. The loaded class is also stored in \'cmdclass\'
to speed future calls to \'get_command_class()\'.
Raises DistutilsModuleError if the expected module could not be
found, or if that module does not define the expected class.
'''
klass = self.cmdclass.get(command)
if klass:
return klass
for pkgname in self.get_command_packages():
module_name = '%s.%s' % (pkgname, command)
klass_name = command
try:
__import__(module_name)
module = sys.modules[module_name]
except ImportError:
continue
try:
klass = getattr(module, klass_name)
except AttributeError:
raise DistutilsModuleError, "invalid command '%s' (no class '%s' in module '%s')" % (command, klass_name, module_name)
self.cmdclass[command] = klass
return klass
raise DistutilsModuleError("invalid command '%s'" % command)
def get_command_obj(self, command, create = 1):
"""Return the command object for 'command'. Normally this object
is cached on a previous call to 'get_command_obj()'; if no command
object for 'command' is in the cache, then we either create and
return it (if 'create' is true) or return None.
"""
cmd_obj = self.command_obj.get(command)
if not cmd_obj and create:
if DEBUG:
print "Distribution.get_command_obj(): creating '%s' command object" % command
klass = self.get_command_class(command)
cmd_obj = self.command_obj[command] = klass(self)
self.have_run[command] = 0
options = self.command_options.get(command)
if options:
self._set_command_options(cmd_obj, options)
return cmd_obj
def _set_command_options(self, command_obj, option_dict = None):
"""Set the options for 'command_obj' from 'option_dict'. Basically
this means copying elements of a dictionary ('option_dict') to
attributes of an instance ('command').
'command_obj' must be a Command instance. If 'option_dict' is not
supplied, uses the standard option dictionary for this command
(from 'self.command_options').
"""
command_name = command_obj.get_command_name()
if option_dict is None:
option_dict = self.get_option_dict(command_name)
if DEBUG:
print " setting options for '%s' command:" % command_name
for source, value in option_dict.items():
try:
bool_opts = map(translate_longopt, command_obj.boolean_options)
except AttributeError:
None if DEBUG else None
None if DEBUG else None
bool_opts = []
except:
None if DEBUG else None
try:
neg_opt = command_obj.negative_opt
except AttributeError:
None if DEBUG else None
None if DEBUG else None
neg_opt = { }
except:
None if DEBUG else None
try:
is_string = type(value) is StringType
if neg_opt.has_key(option) and is_string:
setattr(command_obj, neg_opt[option], not strtobool(value))
elif option in bool_opts and is_string:
setattr(command_obj, option, strtobool(value))
elif hasattr(command_obj, option):
setattr(command_obj, option, value)
else:
raise DistutilsOptionError, "error in %s: command '%s' has no such option '%s'" % (source, command_name, option)
continue
except ValueError:
None if DEBUG else None
msg = None if DEBUG else None
raise DistutilsOptionError, msg
continue
def reinitialize_command(self, command, reinit_subcommands = 0):
'''Reinitializes a command to the state it was in when first
returned by \'get_command_obj()\': ie., initialized but not yet
finalized. This provides the opportunity to sneak option
values in programmatically, overriding or supplementing
user-supplied values from the config files and command line.
You\'ll have to re-finalize the command object (by calling
\'finalize_options()\' or \'ensure_finalized()\') before using it for
real.
\'command\' should be a command name (string) or command object. If
\'reinit_subcommands\' is true, also reinitializes the command\'s
sub-commands, as declared by the \'sub_commands\' class attribute (if
it has one). See the "install" command for an example. Only
reinitializes the sub-commands that actually matter, ie. those
whose test predicates return true.
Returns the reinitialized command object.
'''
Command = Command
import distutils.cmd
if not isinstance(command, Command):
command_name = command
command = self.get_command_obj(command_name)
else:
command_name = command.get_command_name()
if not command.finalized:
return command
command.initialize_options()
command.finalized = 0
self.have_run[command_name] = 0
self._set_command_options(command)
if reinit_subcommands:
for sub in command.get_sub_commands():
self.reinitialize_command(sub, reinit_subcommands)
return command
def announce(self, msg, level = 1):
log.debug(msg)
def run_commands(self):
"""Run each command that was seen on the setup script command line.
Uses the list of commands found and cache of command objects
created by 'get_command_obj()'.
"""
for cmd in self.commands:
self.run_command(cmd)
def run_command(self, command):
"""Do whatever it takes to run a command (including nothing at all,
if the command has already been run). Specifically: if we have
already created and run the command named by 'command', return
silently without doing anything. If the command named by 'command'
doesn't even have a command object yet, create one. Then invoke
'run()' on that command object (or an existing one).
"""
if self.have_run.get(command):
return None
log.info('running %s', command)
cmd_obj = self.get_command_obj(command)
cmd_obj.ensure_finalized()
cmd_obj.run()
self.have_run[command] = 1
def has_pure_modules(self):
if not self.packages and self.py_modules:
pass
return len([]) > 0
def has_ext_modules(self):
if self.ext_modules:
pass
return len(self.ext_modules) > 0
def has_c_libraries(self):
if self.libraries:
pass
return len(self.libraries) > 0
def has_modules(self):
if not self.has_pure_modules():
pass
return self.has_ext_modules()
def has_headers(self):
if self.headers:
pass
return len(self.headers) > 0
def has_scripts(self):
if self.scripts:
pass
return len(self.scripts) > 0
def has_data_files(self):
if self.data_files:
pass
return len(self.data_files) > 0
def is_pure(self):
if self.has_pure_modules() and not self.has_ext_modules():
pass
return not self.has_c_libraries()
class DistributionMetadata:
'''Dummy class to hold the distribution meta-data: name, version,
author, and so forth.
'''
_METHOD_BASENAMES = ('name', 'version', 'author', 'author_email', 'maintainer', 'maintainer_email', 'url', 'license', 'description', 'long_description', 'keywords', 'platforms', 'fullname', 'contact', 'contact_email', 'license', 'classifiers', 'download_url')
def __init__(self):
self.name = None
self.version = None
self.author = None
self.author_email = None
self.maintainer = None
self.maintainer_email = None
self.url = None
self.license = None
self.description = None
self.long_description = None
self.keywords = None
self.platforms = None
self.classifiers = None
self.download_url = None
def write_pkg_info(self, base_dir):
'''Write the PKG-INFO file into the release tree.
'''
pkg_info = open(os.path.join(base_dir, 'PKG-INFO'), 'w')
pkg_info.write('Metadata-Version: 1.0\n')
pkg_info.write('Name: %s\n' % self.get_name())
pkg_info.write('Version: %s\n' % self.get_version())
pkg_info.write('Summary: %s\n' % self.get_description())
pkg_info.write('Home-page: %s\n' % self.get_url())
pkg_info.write('Author: %s\n' % self.get_contact())
pkg_info.write('Author-email: %s\n' % self.get_contact_email())
pkg_info.write('License: %s\n' % self.get_license())
if self.download_url:
pkg_info.write('Download-URL: %s\n' % self.download_url)
long_desc = rfc822_escape(self.get_long_description())
pkg_info.write('Description: %s\n' % long_desc)
keywords = string.join(self.get_keywords(), ',')
if keywords:
pkg_info.write('Keywords: %s\n' % keywords)
for platform in self.get_platforms():
pkg_info.write('Platform: %s\n' % platform)
for classifier in self.get_classifiers():
pkg_info.write('Classifier: %s\n' % classifier)
pkg_info.close()
def get_name(self):
if not self.name:
pass
return 'UNKNOWN'
def get_version(self):
if not self.version:
pass
return '0.0.0'
def get_fullname(self):
return '%s-%s' % (self.get_name(), self.get_version())
def get_author(self):
if not self.author:
pass
return 'UNKNOWN'
def get_author_email(self):
if not self.author_email:
pass
return 'UNKNOWN'
def get_maintainer(self):
if not self.maintainer:
pass
return 'UNKNOWN'
def get_maintainer_email(self):
if not self.maintainer_email:
pass
return 'UNKNOWN'
def get_contact(self):
if not self.maintainer and self.author:
pass
return 'UNKNOWN'
def get_contact_email(self):
if not self.maintainer_email and self.author_email:
pass
return 'UNKNOWN'
def get_url(self):
if not self.url:
pass
return 'UNKNOWN'
def get_license(self):
if not self.license:
pass
return 'UNKNOWN'
get_licence = get_license
def get_description(self):
if not self.description:
pass
return 'UNKNOWN'
def get_long_description(self):
if not self.long_description:
pass
return 'UNKNOWN'
def get_keywords(self):
if not self.keywords:
pass
return []
def get_platforms(self):
if not self.platforms:
pass
return [
'UNKNOWN']
def get_classifiers(self):
if not self.classifiers:
pass
return []
def get_download_url(self):
if not self.download_url:
pass
return 'UNKNOWN'
def fix_help_options(options):
"""Convert a 4-tuple 'help_options' list as found in various command
classes to the 3-tuple form required by FancyGetopt.
"""
new_options = []
for help_tuple in options:
new_options.append(help_tuple[0:3])
return new_options
if __name__ == '__main__':
dist = Distribution()
print 'ok'